cmake_minimum_required(VERSION 3.22)

project(CMakeRookie VERSION 0.1)

set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_CXX_STANDARD 11)

option(USE_MYMATH "Use tutorial provided math implementation" ON)
configure_file(CMakeRookieConfig.h.in CMakeRookieConfig.h)

if(USE_MYMATH)
    add_subdirectory(mathfunctions)
    list(APPEND EXTRA_LIBS MathFunctions)
    list(APPEND EXTRA_INCLUDES "${PROJECT_SOURCE_DIR}/MathFunctions")
endif()

add_executable(CMakeRookie tutorial.cxx)
target_link_libraries(CMakeRookie PUBLIC ${EXTRA_LIBS})
target_include_directories(CMakeRookie PUBLIC
        "${PROJECT_BINARY_DIR}"
        ${EXTRA_INCLUDES}
        )